// LennardJones.cpp: archivo de proyecto principal.

#include <complex>
#include <fstream>
#include <iostream>
//#include <ofstream.h>
#include <string.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include<time.h>


using namespace std;


#define kB 8.314e-03
#define maxK 10000
#define KsqMax  49
#define Kmax 7
#define pi 3.1416

#include "utils.h"
#include "particulas.h"
#include "caja.h"
#include "verlet.h"

int main(void)
{
	double Temp=0.1;
	double delta=1.0;
	double diff=0.005;
	int npart=1000;
	double phi=0.1;
	double rcut=2.5;
	double Etotal;
	double Dt=0.005;
	char sdata[10];

	char name[30];
	sprintf(name,"%s","config");
	caja *box = new caja(npart, Temp, phi, rcut);

	box->linkCell();

	



	for (int i=0;i<1000;i++)
	{
		verletLinkCellList(box,Dt);
	}

	int celda=201;
	cout<<"*******************************************"<<endl;
	int p1, p2;
	for (celda=0;celda<box->ncell3;celda++)
	{
	p1 = box->head[celda];
	if(p1!=-1)
	{
		sprintf(sdata,"%d",celda);
		//cout<<"En caja "<<sdata;
		sprintf(sdata,"%d",p1);
		//cout<<" Particula: "<<sdata<<endl;
		p2=box->link[p1];
		while(p2!=-1)
		{
			//cout<<"En caja "<<celda<<" Particula: "<<p2<<endl;
			//cout<<"distancia: "<<box->distancia(p1,p2)<<endl;
			//cout<<"En caja "<<celda<<" Particula: "<<p2<<endl;
			p2=box->link[p2];
		}
	}
	}
	

		
		//verlet(box,Dt);
		verletLinkCellList(box,Dt);
		//randomMovement(box,0.05);
	/*	if(i%100==0)
		{
		cout<<Etotal<<endl;
		box->printXYZfile(name, i);
		}*/
	

	delete box;



//	cout<<"sacabo"<<endl;
	//system("PAUSE");
	return 0;
}

